package com.lj.dao;

import java.util.Calendar;
import java.util.Date;

/**
 * Created by dave on 2018/1/13.
 */
public class StaticData {
    static Date date;
    static String startDate;
    static {
        date=new Date();
        startDate=null;
    }
    public static boolean checkAndSet(){
        boolean isNewDay=false;
        Date now=new Date();
        Calendar calendar=Calendar.getInstance();
        calendar.setTime(date);
        int d=calendar.get(Calendar.DATE);
        Calendar calendarNow=Calendar.getInstance();
        calendarNow.setTime(now);
        int d1=calendarNow.get(Calendar.DATE);
        if(d1!=d){
            isNewDay=true;
        }
        date=now;
        return isNewDay;
    }
    public static void setStartDate(String sd){
        startDate=sd;
    }
    public static String getStartDate() {
        return startDate;
    }
}
